package com.aos.erp.manager.enums.message;

import com.baomidou.mybatisplus.core.enums.IEnum;

import java.io.Serializable;

public enum PushType implements IEnum {
    app(1, "APP"),
    wx_public(2, "微信公众号"),
    wx_applet(3, "微信小程序"),
    sms(4, "短信"),
    sms_timely(5, "及时短信");

    private int value;
    private String desc;

    PushType(final int value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Serializable getValue() {
        return this.value;
    }


    public String getDesc() {
        return this.desc;
    }

    public static String getDesc(String value) {
        String pushTypeDesc = "";
        int pushTypeValue = 0;
        try {
            pushTypeValue = Integer.parseInt(value);
        } catch (Exception ex ) {

        }
        if(pushTypeValue == app.value) {
            pushTypeDesc = app.desc;
        } else if(pushTypeValue == wx_public.value) {
            pushTypeDesc = wx_public.desc;
        } else if(pushTypeValue == wx_applet.value) {
            pushTypeDesc = wx_applet.desc;
        } else if(pushTypeValue == sms.value) {
            pushTypeDesc = sms.desc;
        }
        return pushTypeDesc;
    }
}
